
<template>
  <div class="runborder">
    <!-- 订单数据 -->
    <div class="orderDataBox flex">
      <div
        v-for="(item, index) in orderData"
        :key="'orderData' + index"
        class="orderDataBoxItem flex-center"
        :style="{color: item.color, backgroundColor: item.bgColor}"
      >
        <div class="font14">{{ item.title }}</div>
        <div class="font24 fontBold">{{ item.value }}</div>
      </div>
    </div>
    <!-- 列表数据 -->
    <div class="listData flex">
      <div class="listDataLeft flexColumn">
        <div class="listTitle">订单列表</div>
        <div class="listSearch">
          <div class="searchBox relative">
            <a-button type="primary" class="searchBtn fr">搜索</a-button>
            <a-input ref="searchInput" v-model="searchData" placeholder="请输入关键词搜索">
              <a-icon type="search" slot="prefix" style="color: #4BB7FF" />
            </a-input>
          </div>
        </div>
        <div class="flex1 flexColumn orderListBox">
          <div
            v-for="(item, index) in orderList"
            :key="'orderList' + index"
            class="flex relative"
            :class="{'active': currentIndex === index}"
            @click="switchListIndex(index)"
          >
            <span class="itemTitle">{{ item.title }}</span>
            <span class="itemValue">{{ item.value }}{{ item.unit }}</span>
            <span class="itemTime">{{ util.timeFormat(item.time) }}</span>
            <span v-if="currentIndex === index" class="triangle"></span>
          </div>
        </div>
      </div>
      <div class="listDataCenter">
        <div class="centerBox"></div>
      </div>
      <!-- 右边内容 -->
      <div class="listDataRight flexColumn">
        <div class="listTitle">生产报警</div>
        <div class="flex1 flexColumn">
          <div v-for="(item, index) in alarmList" :key="'alarmList' + index" class="itemBox">
            <div class="itemTop flex relative">
              <span class="round bg-red"></span>
              <span>【{{ item.type }}】</span>
              <span class="color-red">{{ item.title }}</span>
            </div>
            <div class="itemBottom flex">
              <span class="color-red">{{ item.status }}</span>
              <span>{{ util.timeFormat2(item.time) }}</span>
            </div>
          </div>
        </div>
        <div class="listTitle">实时内容</div>
        <div class="flex1">
          <div class="flex1 flexColumn">
            <div v-for="(item, index) in realTimeList" :key="'alarmList' + index" class="itemBox">
              <div class="itemTop flex relative">
                <span class="round bg-blue"></span>
                <span>【{{ item.type }}】</span>
                <span class="color-blue">{{ item.title }}</span>
              </div>
              <div class="itemBottom flex">
                <span class="color-blue">{{ item.status }}</span>
                <!-- <span>{{ util.timeFormat2(item.time) }}</span> -->
                <span>{{item.times}}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 底部数据 -->
    <div class="productData flex">
      <div class="flex1 productDataLeft flexColumn">
        <div class="listTitle">生产工厂</div>
        <div class="leftTitle flex">
          <span>生产状态数据集合</span>
          <span class="labelBox bg-yellow"></span>
          <span>生产计划量</span>
          <span class="labelBox bg-blue"></span>
          <span>产出量</span>
        </div>
        <div class="flex1">
          <div class="progressBox">
            <div
              v-for="(item, index) in productData"
              :key="'productData' + index"
              class="flex progressBoxItem"
            >
              <span class="progressTitle">{{ item.title }}</span>
              <span class="progressValue color-yellow">{{ item.value }}</span>
              <a-progress :percent="item.percent" class="progressWrap" />
              <a-button type="primary" class="searchBtn bg-blue" style="height: 24px">详情</a-button>
            </div>
          </div>
        </div>
      </div>
      <div class="productDataRight flexColumn">
        <div class="listTitle">企业通讯</div>
        <div class="rightNav flex">
          <div class="flex-align-center" style="color: #008AFF">
            <img src="../../../assets/icons/message.png" />
            消息通知
          </div>
          <div class="flex-align-center">
            <img src="../../../assets/icons/person.png" />
            联系人
          </div>
        </div>
        <div class="rightList flex1">
          <div
            v-for="(item, index) in messageData"
            :key="'messageData' + index"
            class="flex-align-center"
          >
            <div
              class="albumBox bg-blue flex-center"
              :style="{backgroundColor: item.color}"
            >{{ item.album }}</div>
            <div class="contentBox">
              <div class="topBox flex-align-center">
                <span>{{ item.name }}</span>
                <span class="font12">下午 14:59</span>
              </div>
              <div class="bottomBox font10 more">{{ item.message }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'runborder',
  data() {
    return {
      searchData: '',
      orderData: [
        { title: '今日订单', value: 2000, color: '#2175FF', bgColor: '#FFFFFF' },
        { title: '生产执行计划产量', value: 1000, color: '#2175FF', bgColor: '#FFFFFF' },
        { title: '生产执行已完成', value: 300, color: '#FFFFFF', bgColor: '#4BB7FF' },
        { title: '生产执行未完成', value: 700, color: '#FFFFFF', bgColor: '#FF5B5B' },
        { title: '生产已入库', value: 200, color: '#FFFFFF', bgColor: '#0AB3DE' },
      ],
      orderList: [
        { title: '技嘉订单AB-025', value: 2000, unit: '元', time: 1628578511075 },
        { title: '技嘉订单AB-006', value: 800, unit: '元', time: 1628578511075 },
        { title: '英伟达订单AB-002', value: 2000, unit: '元', time: 1628578511075 },
        { title: '技嘉订单AB-004', value: 1000, unit: '元', time: 1628578511075 },
        { title: '英伟达订单AB-002', value: 12000, unit: '元', time: 1628578511075 },
        { title: '技嘉订单AA-07889', value: 4000, unit: '元', time: 1628578511075 },
        { title: '技嘉订单AB-006', value: 20000, unit: '元', time: 1628578511075 },
        { title: '英伟达订单AB-002', value: 16000, unit: '元', time: 1628578511075 },
        { title: '技嘉订单AB-004', value: 260, unit: '元', time: 1628578511075 },
        { title: '英伟达订单AB-002', value: 2600, unit: '元', time: 1628578511075 },
      ],

      realTimeList: [
        { type: '生产', title: 'SMT-L4 上扳机 备料到达', status: '5%', time: '08-30 13:35:15' },
        { type: '质检', title: 'Side5 QA抽检入库 ABS-000002', status: '5%', time: '08-30 13:30:28' },
        { type: '生产', title: '新增技嘉订单 AB-0256 开始备料', status: '备料', time: '08-30 12:58:19' },
        { type: '生产', title: 'Side5 QA抽检入库 ABB-000004', status: '4%', time: '08-30 12:36:28' },
      ],
      productData: [
        { title: '龙华SMT车间', value: 100, percent: 20 },
        { title: '宝安SMT车间', value: 100, percent: 82 },
        { title: '龙华SMT车间', value: 100, percent: 20 },
        { title: '龙华SMT车间', value: 100, percent: 50 },
        { title: '盐田SMT车间', value: 100, percent: 20 },
      ],
      messageData: [
        {
          name: '生产一组',
          time: 1628578511075,
          message: '[分享]进度实时在线监控 分享了一个链接,赶快点击查看...',
          album: 'sc',
          color: '#2175FF',
        },
        { name: '质检五组', time: 1628578511075, message: '刚刚的文件再发我一次', album: '质', color: '#2175FF' },
        {
          name: 'SMT办公室',
          time: 1628578511075,
          message: '生产进度怎么样了，有人能跟我说一下情况吗，我这边...',
          album: 'SMT',
          color: '#FFB811',
        },
        {
          name: '黄渤',
          time: 1628578511075,
          message: '把你们组的生产计划跟我这边对一下',
          album: '渤',
          color: '#FF5757',
        },
        { name: '生产调度办公室', time: 1628578511075, message: '今晚加加班', album: '调', color: '#09C76E' },
      ],
      currentIndex: 0,
    }
  },
  methods: {
    switchListIndex(index) {
      this.currentIndex = index
    },
  },
}
</script>

<style lang="less">
.runborder {
  margin-top: 10px;
  padding-bottom: 24px;
  /* 订单数据 */
  .orderDataBox {
    height: 100px;
    justify-content: space-between;
    .orderDataBoxItem {
      width: 19.2%;
      border-radius: 4px;
      flex-direction: column;
    }
  }
  /* 列表数据 */
  .listData {
    margin-top: 10px;
    height: 514px;
    .listDataLeft {
      width: 300px;
      height: 100%;
      float: left;
      .orderListBox {
        overflow: auto;
        background-color: white;
        .active {
          background-color: #f5f5f7;
          color: #2175ff;
          .itemTitle {
            color: #2175ff;
          }
        }
        & > div {
          cursor: pointer;
          height: 32px;
          line-height: 32px;
          padding: 0 10px;
          font-size: 14px;
          .itemTitle {
            width: 48%;
            color: #888888;
          }
          .itemValue {
            width: 20%;
            text-align: right;
          }
          .itemTime {
            width: 30%;
            text-align: right;
          }
        }
      }
    }
    .listDataRight {
      width: 300px;
      height: 100%;
      float: right;
      background-color: white;
      .itemBox {
        margin-top: 10px;
        height: 42px;
        padding-left: 30px;
        .itemBottom {
          padding: 0 10px;
          justify-content: space-between;
        }
      }
    }
    .listDataCenter {
      flex: 1;
      height: 100%;
      .centerBox {
        height: 100%;
        margin: 0 10px;
        background-color: white;
      }
    }
  }
  /* 列表搜索 */
  .listSearch {
    .searchBox {
      background-color: white;
      .ant-input-affix-wrapper {
        width: 70%;
        float: none;
        margin-left: 10px;
      }
      .searchBtn {
        margin: 0;
        margin-right: 10px;
      }
    }
  }
  /* 底部栏 */
  .productData {
    margin-top: 10px;
    height: 300px;
    .productDataLeft {
      background: white;
      .leftTitle {
        font-size: 14px;
        font-weight: 700;
        height: 40px;
        padding: 0 10px;
        border-bottom: 1px solid #f0f0f0;
        align-items: center;
      }
      .progressBox {
        height: 100%;
        padding: 20px;
        & > div {
          border-bottom: 1px solid #f0f0f0;
          align-items: center;
          height: 36px;
          box-sizing: border-box;
          .progressTitle {
            width: 100px;
            // flex: 2;
          }
          .progressValue {
            width: 40px;
            // flex: 1;
          }
          .progressWrap {
            margin-right: 20px;
            flex: 1;
            .ant-progress-text {
              color: #2175ff;
            }
          }
        }
      }
    }
    .productDataRight {
      width: 300px;
      height: 100%;
      float: right;
      margin-left: 10px;
      background-color: white;
      .rightNav {
        height: 40px;
        padding: 0 10px;
        border-bottom: 1px solid #f0f0f0;
        align-items: center;
        div {
          margin-right: 20px;
          cursor: pointer;
          img {
            margin-right: 6px;
          }
        }
      }
      .rightList {
        & > div {
          height: 36px;
          padding: 0 10px;
          margin: 7px 0;
          .albumBox {
            height: 30px;
            min-width: 30px;
            border-radius: 4px;
            color: white;
            margin-right: 10px;
          }
          .contentBox {
            flex: 1;
            .topBox {
              justify-content: space-between;
            }
            .bottomBox {
              color: #888888;
              width: 240px;
              position: relative;
              left: -22px;
              top: -2px;
            }
          }
        }
      }
    }
  }
}
</style>